home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
Writeframe.cpp
< prev
Wrap
C/C++ Source or Header
|
2000-01-16
|
2KB
|
111 lines
#include "stdafx.h"
int view_backgroundarea = TRUE, view_gamearea = TRUE, low_detail_level = FALSE;
void write_frame()
{
// Check if this makes sense
if (DD == 0)
return;
// Update bitmaps in video memory
cBMP::make_dynamic_use_of_video_mem();
// write dirty parts of the screen
if (no_parallax)
{
game_surface->do_scroll();
game_surface->write_dirty();
game_surface->blit_to_backbuffer();
}
else
{
// Write background surface
if (!end_game || view_backgroundarea)
{
back_surface->do_scroll();
back_surface->write_dirty();
back_surface->blit_to_backbuffer();
}
else
{
back_surface->clear_backbuffer();
}
// Write game surface
if (!end_game || view_gamearea)
{
game_surface->do_scroll();
game_surface->write_dirty();
game_surface->blit_to_backbuffer();
}
}
// Write left & right surfaces
left_surface->do_scroll();
left_surface->write_dirty();
left_surface->blit_to_backbuffer();
right_surface->do_scroll();
right_surface->write_dirty();
right_surface->blit_to_backbuffer();
// Write info surface
if (info_surface != 0 && (debug || end_game))
{
info_surface->clear(mask_color);
lock_surface_for_primitives(info_surface);
draw_grid();
write_debug_info();
cEditable::write_editables();
unlock_surface_for_primitives();
info_surface->blit_to_backbuffer();
}
// Write gravity effects
write_gravity();
// Make page visible
if (inawin)
{
// Create a clipper?
if (clipper == 0)
init_directdraw_clipper();
// Compute the position where to blit to
CRect r(0, 0, SCREEN_X, SCREEN_Y);
gamewindow->ClientToScreen((LPPOINT)&r);
gamewindow->ClientToScreen((LPPOINT)&r + 1);
r.left -= gamewindow->GetScrollPosition().x;
r.right -= gamewindow->GetScrollPosition().x;
// Do the blit
while (!draw_ok(screen->Blt(&r, backbuffer, 0, DDBLT_WAIT, 0)));
}
else
{
// We're full screen, just flip
while (!draw_ok(screen->Flip(0, DDFLIP_WAIT)));
}
// All dirty rectangles have been processed
cSurface::all_surfaces_not_dirty();
}